package cn.tedu.boot22.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class BMIController {
    @RequestMapping("/bmi")
    @ResponseBody
    public String bmi(double height,double weight){
        double bmi = weight/(height*height);
        System.out.println("height = " + height + ", weight = " + weight);
        System.out.println("bmi:"+bmi);
        if(bmi<18.5){
            return "兄弟你瘦了!";//return关键字直接结束方法返回
        }
        if(bmi<24){
            return "身体倍儿棒!";
        }
        if(bmi<28){
            return "有点小胖啊";
        }
        return "可以少吃一点了";
    }
}
